CREATE TABLE [dbo].[BaseCostTiming](
	[BaseCostTimingId] [int] IDENTITY(1,1) NOT NULL,
	[Timing] [varchar](50) NOT NULL,
	[RatePerPush] [money] NOT NULL,
	[FixedCost] [money] NOT NULL,
 CONSTRAINT [PK_BaseCostTiming] PRIMARY KEY CLUSTERED 
(
	[BaseCostTimingId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BaseCostTiming] ADD  CONSTRAINT [DF_BaseCostTiming_RatePerPush]  DEFAULT ((0)) FOR [RatePerPush]
GO
ALTER TABLE [dbo].[BaseCostTiming] ADD  CONSTRAINT [DF_BaseCostTiming_FixedCost]  DEFAULT ((0)) FOR [FixedCost]
GO
CREATE PROCEDURE [dbo].[spBaseCostTiming_GetList]
AS
BEGIN
	SET NOCOUNT ON

	SELECT *
	FROM [BaseCostTiming] (NOLOCK)
END
GO
CREATE PROCEDURE [dbo].[spBaseCostTiming_Update]
(
	@BaseCostTimingId INT,
	@Timing VARCHAR(50),
	@RatePerPush MONEY,
	@FixedCost MONEY
)
AS

BEGIN
	SET NOCOUNT ON

	UPDATE BaseCostTiming
	SET Timing = @Timing, RatePerPush = @RatePerPush, FixedCost = @FixedCost
	WHERE (BaseCostTimingId = @BaseCostTimingId)
END
GO

SET IDENTITY_INSERT [dbo].[BaseCostTiming] ON
INSERT [dbo].[BaseCostTiming] ([BaseCostTimingId], [Timing], [RatePerPush], [FixedCost]) VALUES (1, N'Base Cost', 0.0000, 0.0000)
INSERT [dbo].[BaseCostTiming] ([BaseCostTimingId], [Timing], [RatePerPush], [FixedCost]) VALUES (2, N'Instant, Now', 0.0000, 0.0000)
INSERT [dbo].[BaseCostTiming] ([BaseCostTimingId], [Timing], [RatePerPush], [FixedCost]) VALUES (3, N'Instant, Scheduled', 0.0000, 0.0000)
INSERT [dbo].[BaseCostTiming] ([BaseCostTimingId], [Timing], [RatePerPush], [FixedCost]) VALUES (4, N'Ongoing, limit by budget', 0.0000, 0.0000)
INSERT [dbo].[BaseCostTiming] ([BaseCostTimingId], [Timing], [RatePerPush], [FixedCost]) VALUES (5, N'Ongoing, Scheduled', 0.0000, 0.0000)
SET IDENTITY_INSERT [dbo].[BaseCostTiming] OFF



